import tkinter as tk
 
top = tk.Tk()
 
val = tk.IntVar()
val.set(4)
a = tk.Radiobutton(top, text='a', variable=val, value=1)
a.pack()
b = tk.Radiobutton(top, text='b', variable=val, value=2)
b.pack()
c = tk.Radiobutton(top, text='c', variable=val, value=3)
c.pack()
d = tk.Radiobutton(top, text='d', variable=val, value=4)
d.pack()

def OnOK():
    if val.get() == 1:
        print('a selected')
    elif val.get() == 2:
        print('b selected')
    elif val.get() == 3:
        print('c selected')
    else:
        print('d selected')

btn = tk.Button(top, text='OK', command=OnOK)
btn.pack()

top.mainloop()
